HTTP状态码查询:在 Agent 中核对 HTTP 状态码与站点可访问性
HTTP状态码查询是 SkillHub 社区 Skill(@user_bba4c100/http-status-code-check,v2.0.0,it-ops-security),用于在 Agent 中查询 HTTP 状态码与网站可访问性,无需 API Key。本文说明其定位、curl/WebFetch 依赖、skillhub 安装路径(含 Cursor/Codex),以及 XiaoMeng AGI/ClawTip 付费说明与包体仅含 SKILL.md 等注意事项。
Read MoreFastAPI Error Handling: Practical Guide to HTTP Status Codes and Exception Catching
API error handling is crucial for system robustness and user experience, and FastAPI provides a concise and efficient error handling mechanism. The core of the article includes: ### 1. Necessity of Error Handling It is necessary to clarify the error cause and use standard HTTP status codes (e.g., 404 for resource not found, 400 for parameter errors) to avoid system crashes and ensure service stability. ### 2. HTTP Status Codes and FastAPI Applications FastAPI supports all standard status codes. Route functions can directly specify them via `return` or `raise`. For example: `return {"detail": "Item not found"}` returns 404, or `HTTPException` can be used to explicitly throw errors. ### 3. FastAPI Exception Catching Mechanism It is recommended to actively throw errors using `HTTPException` with specified status codes and messages, such as returning 404 when a user does not exist. FastAPI automatically handles parameter type errors and returns a 422 status code. ### 4. Custom Exceptions and Global Fallback Business logic exceptions (e.g., insufficient balance) can be defined and uniformly handled using `@app.exception_handler` to return standard errors. The global exception handler falls back to uncaught exceptions to prevent server crashes. ### Best Practices Use `HTTPException` for standard errors, custom exceptions for business logic, and leverage automatic parameter
Read More